package com.sugar.domain.system.privilege;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.sugar.domain.oa.hr.Employee;

@Entity@Table(name="sugar_PrivilegeRole")
public class PrivilegeRole {
	
	private int r_id ;
	
	private String r_name ;
	
	private String r_desc ;
	
	private Date addTime = new Date() ;
	
	private Set<PrivilegeResourceItem> mres ;
	
	private Set<Employee> emp ;

	@ManyToMany(mappedBy="role")
	@JoinTable(name="sugar_privilege_role_emp",
			joinColumns={@JoinColumn(name="roleid_empid")},
			inverseJoinColumns={@JoinColumn(name="empid_roleid")})
	public Set<Employee> getEmp() {
		return emp;
	}

	public void setEmp(Set<Employee> emp) {
		this.emp = emp;
	}

	@ManyToMany
	@JoinTable(name="sugar_privilege_role_resource",
			joinColumns={@JoinColumn(name="roleid_resid")},
			inverseJoinColumns={@JoinColumn(name="resid_roleid")})
	public Set<PrivilegeResourceItem> getMres() {
		return mres;
	}

	public void setMres(Set<PrivilegeResourceItem> mres) {
		this.mres = mres;
	}

	@Id@GeneratedValue
	public int getR_id() {
		return r_id;
	}

	public void setR_id(int rId) {
		r_id = rId;
	}

	public String getR_name() {
		return r_name;
	}

	public void setR_name(String rName) {
		r_name = rName;
	}

	public String getR_desc() {
		return r_desc;
	}

	public void setR_desc(String rDesc) {
		r_desc = rDesc;
	}

	public Date getAddTime() {
		return addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}

}
